home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / texchang.arc / weave < prev   
Text File  |  1990-03-16  |  7KB  |  278 lines

  1. WEAVE change file for the Atari ST
  2. Author: Nico Poppelier.
  3. Date  : December 30, 1988.
  4.         Increased max_refs and max_toks as in Version 2.6.
  5.  
  6. Due to an error in the Prospero Pascal compiler the control
  7. variable of the FOR loop in section 85 is judged 'insecure',
  8. i.e., it looks as if it is modified by a routine.
  9. To avoid this error a new loop variable k is introduced.
  10.  
  11. @x
  12. \pageno=\contentspagenumber \advance\pageno by 1
  13. @y
  14. \pageno=\contentspagenumber \advance\pageno by 1
  15. % \let\maybe=\iffalse
  16. % \def\title{WEAVE changes for the Atari ST}
  17. \def\title{WEAVE, Version 2.8 for the Atari ST}
  18. @z
  19.  
  20. @x
  21. @d banner=='This is WEAVE, Version 2.8'
  22. @y
  23. @d banner=='This is WEAVE, Version 2.8 for the Atari ST'
  24. @z
  25.  
  26. @x
  27. and |change_file|, and the \TeX\ output goes to file |tex_file|.
  28. @y
  29. and |change_file|, and the \TeX\ output goes to file |tex_file|.
  30. Prospero Pascal requires us to mention |input| and |output|
  31. in the program header, too.
  32. They are used for terminal input and output.
  33. @z
  34.  
  35. @x
  36. program WEAVE(@!web_file,@!change_file,@!tex_file);
  37. @y
  38. program WEAVE(@!input,@!output,
  39.               @!web_file,@!change_file,@!tex_file);
  40. @z
  41.  
  42. @x
  43. procedure initialize;
  44. @y
  45. procedure wait(delay:real); external;
  46. procedure initialize;
  47. @z
  48.  
  49. @x
  50.   begin @<Set initial values@>@/
  51. @y
  52.   begin @<Preset initial values@>@/
  53.   @<Set initial values@>@/
  54. @z
  55.  
  56. @x
  57. @d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
  58. @d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
  59. @y
  60. @d debug== {we are debugging}
  61. @d gubed==
  62. @z
  63.  
  64. @x
  65. @d stat==@{ {change this to `$\\{stat}\equiv\null$'
  66.   when gathering usage statistics}
  67. @d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
  68.   when gathering usage statistics}
  69. @y
  70. @d stat== {we are gathering usage statistics}
  71. @d tats==
  72. @z
  73.  
  74. @x
  75. @<Compiler directives@>=
  76. @{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
  77. @!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
  78. @y
  79. On the Atari ST, things are a bit different:
  80. Prospero Pascal does not allow in-comment directives.
  81.  
  82. @<Compiler directives@>=
  83. @z
  84.  
  85. @x
  86. @d othercases == others: {default for cases not listed explicitly}
  87. @y
  88. @d othercases == otherwise {default for cases not listed explicitly}
  89. @z
  90.  
  91. @x
  92. @!max_refs=20000; {number of cross references; must be less than 65536}
  93. @!max_toks=20000; {number of symbols in \PASCAL\ texts being parsed;
  94. @y
  95. @!max_refs=30000; {number of cross references; must be less than 65536}
  96. @!max_toks=30000; {number of symbols in \PASCAL\ texts being parsed;
  97. @z
  98.  
  99. @x
  100. @!text_file=packed file of text_char;
  101. @y
  102. @!text_file=text;
  103. @z
  104.  
  105. @x
  106. @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
  107. @y
  108. @d term_in==input
  109. @d term_out==output
  110. @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
  111. @z
  112.  
  113. @x
  114. @!term_out:text_file; {the terminal as an output file}
  115. @y
  116. @z
  117.  
  118. @x
  119. rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
  120. @y
  121. @z
  122.  
  123. @x
  124. @d update_terminal == break(term_out) {empty the terminal output buffer}
  125. @y
  126. @d update_terminal == {emptying the output buffer is not necessary}
  127. @z
  128.  
  129. @x
  130. @ The following code opens |tex_file|.
  131. Since this file was listed in the program header, we assume that the
  132. \PASCAL\ runtime system has checked that a suitable external file name has
  133. been given.
  134. @^system dependencies@>
  135.  
  136. @<Set init...@>=
  137. rewrite(tex_file);
  138. @y
  139. @ The following code opens |tex_file|.
  140. Actually, on the Atari ST this task is put off until later.
  141. @^system dependencies@>
  142. @z
  143.  
  144. @x
  145. @!loc:0..long_buf_size; {the next character position to be read from the buffer}
  146. @y
  147. @!loc:0..long_buf_size; {the next character position to be read from the buffer}
  148. @!k:integer; {extra loop variable}
  149. @z
  150.  
  151. @x
  152.   begin for loc:=0 to change_limit do buffer[loc]:=change_buffer[loc];
  153. @y
  154.   begin for k:=0 to change_limit do buffer[k]:=change_buffer[k];
  155. @z
  156.  
  157. @x
  158. @!term_in:text_file; {the user's terminal as an input file}
  159. @y
  160. @z
  161.  
  162. @x
  163. reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
  164. @y
  165. @z
  166.  
  167. @x
  168. print_ln(banner); {print a ``banner line''}
  169. @y
  170. @z
  171.  
  172. @x
  173. @t\4\4@>{here files should be closed if the operating system requires it}
  174. @<Print the job |history|@>;
  175. end.
  176. @y
  177. if history<fatal_message then
  178.         @= close@>(tex_file, true);
  179. @<Print the job |history|@>; wait(3);
  180. end.
  181. @z
  182.  
  183. @x
  184. This module should be replaced, if necessary, by changes to the program
  185. that are necessary to make \.{WEAVE} work at a particular installation.
  186. It is usually best to design your change file so that all changes to
  187. previous modules preserve the module numbering; then everybody's version
  188. will be consistent with the printed program. More extensive changes,
  189. which introduce new modules, can be inserted here; then only the index
  190. itself will get a new module number.
  191. @y
  192. Here are the remaining changes to the program
  193. that are necessary to make \.{WEAVE} work on the Atari ST.
  194.  
  195. @ @<Local...@>=
  196. @!ask,@!name_found:boolean;
  197. @!file_name,@!job_name:s @& t @& r @& i @& n @& g;
  198. @!name_length,@!name_index: integer;
  199.  
  200. @ Get the external file names, and then call |open|
  201. to associate an external file with each file variable.
  202.  
  203. @<Preset init...@>=
  204. print_ln(banner); {print a ``banner'' line}
  205.  
  206. getcomm(job_name);
  207. name_length:=l @& e @& n @& g @& t @& h(job_name); name_index:=1;
  208. while (name_index <= name_length) and
  209.       (job_name[name_index] = ' ') do incr(name_index);
  210. name_found:=name_index <= name_length;
  211. if name_found then delete(job_name, 1, name_index-1);
  212.  
  213. if name_found then begin
  214.   file_name:=concat(job_name,'.WEB');
  215.   assign(web_file,file_name);
  216.   ask:=not fstat(file_name);
  217.   if ask then write_ln('Couldn''t open ',file_name);
  218. end
  219. else ask:=true;
  220. while ask do begin
  221.   write('Web file: ');
  222.   if eof then begin mark_fatal; jump_out; end;
  223.   read_ln(file_name);
  224.   if checkfn(file_name) then begin
  225.     ask:= not fstat(file_name);
  226.     if ask then write_ln('Couldn''t open ',file_name)
  227.            else assign(web_file,file_name);
  228.   end
  229.   else begin
  230.     ask:=true; write_ln('"',file_name,'" is not a good filename')
  231.   end;
  232. end;
  233.  
  234. if name_found then begin
  235.   file_name:=concat(job_name,'.CH');
  236.   assign(change_file,file_name);
  237.   ask:=not fstat(file_name);
  238.   if ask then write_ln('Couldn''t open ',file_name);
  239. end
  240. else ask:=true;
  241. while ask do begin
  242.   write('Change file: ');
  243.   if eof then begin mark_fatal; jump_out; end;
  244.   read_ln(file_name);
  245.   if file_name='' then file_name:='empty.ch';
  246.   if checkfn(file_name) then begin
  247.     ask:=not fstat(file_name);
  248.     if ask then write_ln('Couldn''t open ',file_name)
  249.            else assign(change_file,file_name);
  250.   end
  251.   else begin
  252.     ask:=true; write_ln('"',file_name,'" is not a good filename')
  253.   end;
  254. end;
  255.  
  256. if name_found then begin
  257.   file_name:=concat(job_name,'.TEX');
  258.   assign(tex_file,file_name);
  259.   ask:=not checkfn(file_name);
  260.   if ask then write_ln('"',file_name,'" is not a good filename')
  261. end
  262. else ask:=true;
  263. while ask do begin
  264.   write('TeX file: ');
  265.   if eof then begin mark_fatal; jump_out; end;
  266.   read_ln(file_name);
  267.   ask := not checkfn(file_name);
  268.   if ask then
  269.     write_ln('"',file_name,'" is not a good filename')
  270.   else
  271.     assign(tex_file,file_name);
  272. end;
  273.  
  274. rewrite(tex_file);
  275. @z
  276.  
  277.  
  278.